import React, {Component} from 'react';
import BasicTab from '../ErpBase/BasicTab';
import ErpUserList from './components/ErpUserList';
import ErpRoleList from './components/ErpRoleList';
import API from '../../tools/API';
import CommonUtils from '../../tools/CommonUtils';

/**
*  综合设置
*/
export default class ErpSynthesis extends Component{
  constructor(props) {
     super(props);
     this.state = {
       tab:'user',
       tabs:[]
     }
  }

  //初始化
  componentWillMount(){
    const tabs = [
      { tab: '人员管理', key: 'user'},
      { tab: '角色管理', key: 'role'},
    ];
    this.setState({
      tab:this.props.match.params != undefined?this.props.match.params.path:'user',
      tabs:CommonUtils.getUserTabs(tabs)
    })
  }

  render(){
    return(
      <div className="base-setting-main">
        <BasicTab tabs={this.state.tabs} activeKey={this.state.tab} changeTab={(val)=> this.setState({tab:val})}/>
        {
          this.state.tab == 'role'?
            <ErpRoleList />
          :
            <ErpUserList />
        }
      </div>
    )
  }

}
